### we prepend t_ to tablenames and f_ to fieldnames for disambiguity


########################################
db.define_table('t_blog',
    Field('id','id',
          represent=lambda id:SPAN(id,' ',A('view',_href=URL('blog_read',args=id)))),
    Field('f_title', type='string', notnull=True,
          label=T('Title')),
    Field('f_tags', type='string',
          label=T('Tags')),
    Field('f_is_final_false', type='boolean',
          label=T('Is Final False')),
    Field('f_added_date', type='string',
          label=T('Added Date')),
    Field('f_added_by_id', type='reference auth_user',
          label=T('Added By Id')),
    Field('f_post', type='text', notnull=True,
          represent=lambda x: MARKMIN(x),
          comment='WIKI (markmin)',
          label=T('Post')),
    Field('active','boolean',default=True,
          label=T('Active'),writable=False,readable=False),
    Field('created_on','datetime',default=request.now,
          label=T('Created On'),writable=False,readable=False),
    Field('modified_on','datetime',default=request.now,
          label=T('Modified On'),writable=False,readable=False,
          update=request.now),
    Field('created_by',db.auth_user,default=auth.user_id,
          label=T('Created By'),writable=False,readable=False),
    Field('modified_by',db.auth_user,default=auth.user_id,
          label=T('Modified By'),writable=False,readable=False,
          update=auth.user_id),
    format='%(f_title)s',
    migrate=settings.migrate)

db.define_table('t_blog_archive',db.t_blog,Field('current_record','reference t_blog'))

########################################
db.define_table('t_resume',
    Field('id','id',
          represent=lambda id:SPAN(id,' ',A('view',_href=URL('resume_read',args=id)))),
    Field('f_title', type='string',
          label=T('Title')),
    Field('f_added_by_id', type='reference auth_user',
          label=T('Added By Id')),
    Field('f_added_date', type='datetime',
          label=T('Added Date')),
    Field('f_content', type='text', notnull=True,
          represent=lambda x: MARKMIN(x),
          comment='WIKI (markmin)',
          label=T('Content')),
    Field('f_version_id_int', type='string',
          label=T('Version Id Int')),
    Field('active','boolean',default=True,
          label=T('Active'),writable=False,readable=False),
    Field('created_on','datetime',default=request.now,
          label=T('Created On'),writable=False,readable=False),
    Field('modified_on','datetime',default=request.now,
          label=T('Modified On'),writable=False,readable=False,
          update=request.now),
    Field('created_by',db.auth_user,default=auth.user_id,
          label=T('Created By'),writable=False,readable=False),
    Field('modified_by',db.auth_user,default=auth.user_id,
          label=T('Modified By'),writable=False,readable=False,
          update=auth.user_id),
    format='%(f_title)s',
    migrate=settings.migrate)

db.define_table('t_resume_archive',db.t_resume,Field('current_record','reference t_resume'))

########################################
db.define_table('t_projects',
    Field('id','id',
          represent=lambda id:SPAN(id,' ',A('view',_href=URL('projects_read',args=id)))),
    Field('f_name', type='string', notnull=True,
          label=T('Name')),
    Field('f_description', type='string', notnull=True,
          label=T('Description')),
    Field('f_url', type='string',
          label=T('Url')),
    Field('f_screenshot', type='string',
          label=T('Screenshot')),
    Field('f_added_date', type='string',
          label=T('Added Date')),
    Field('f_added_by_id', type='reference auth_user',
          label=T('Added By Id')),
    Field('f_is_final_false', type='boolean',
          label=T('Is Final False')),
    Field('active','boolean',default=True,
          label=T('Active'),writable=False,readable=False),
    Field('created_on','datetime',default=request.now,
          label=T('Created On'),writable=False,readable=False),
    Field('modified_on','datetime',default=request.now,
          label=T('Modified On'),writable=False,readable=False,
          update=request.now),
    Field('created_by',db.auth_user,default=auth.user_id,
          label=T('Created By'),writable=False,readable=False),
    Field('modified_by',db.auth_user,default=auth.user_id,
          label=T('Modified By'),writable=False,readable=False,
          update=auth.user_id),
    format='%(f_name)s',
    migrate=settings.migrate)

db.define_table('t_projects_archive',db.t_projects,Field('current_record','reference t_projects'))

########################################
db.define_table('t_news',
    Field('id','id',
          represent=lambda id:SPAN(id,' ',A('view',_href=URL('news_read',args=id)))),
    Field('f_title', type='string', notnull=True,
          label=T('Title')),
    Field('f_tags', type='string',
          label=T('Tags')),
    Field('f_content', type='text', notnull=True,
          represent=lambda x: MARKMIN(x),
          comment='WIKI (markmin)',
          label=T('Content')),
    Field('f_added_date', type='string',
          label=T('Added Date')),
    Field('f_is_final_false', type='boolean',
          label=T('Is Final False')),
    Field('f_added_by_id', type='reference auth_user',
          label=T('Added By Id')),
    Field('active','boolean',default=True,
          label=T('Active'),writable=False,readable=False),
    Field('created_on','datetime',default=request.now,
          label=T('Created On'),writable=False,readable=False),
    Field('modified_on','datetime',default=request.now,
          label=T('Modified On'),writable=False,readable=False,
          update=request.now),
    Field('created_by',db.auth_user,default=auth.user_id,
          label=T('Created By'),writable=False,readable=False),
    Field('modified_by',db.auth_user,default=auth.user_id,
          label=T('Modified By'),writable=False,readable=False,
          update=auth.user_id),
    format='%(f_title)s',
    migrate=settings.migrate)

db.define_table('t_news_archive',db.t_news,Field('current_record','reference t_news'))
